<html><body>
<style>

body, h1, h2, h3, div, span, p, pre, a {
  margin: 0;
  padding: 0;
  border: 0;
  font-weight: inherit;
  font-style: inherit;
  font-size: 100%;
  font-family: inherit;
  vertical-align: baseline;
}

body {
  font-size: 13px;
  padding: 1em;
}

h1 {
  font-size: 26px;
  margin-bottom: 1em;
}

h2 {
  font-size: 24px;
  margin-bottom: 1em;
}

h3 {
  font-size: 20px;
  margin-bottom: 1em;
  margin-top: 1em;
}

pre, code {
  line-height: 1.5;
  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}

pre {
  margin-top: 0.5em;
}

h1, h2, h3, p {
  font-family: Arial, sans serif;
}

h1, h2, h3 {
  border-bottom: solid #CCC 1px;
}

.toc_element {
  margin-top: 0.5em;
}

.firstline {
  margin-left: 2 em;
}

.method  {
  margin-top: 1em;
  border: solid 1px #CCC;
  padding: 1em;
  background: #EEE;
}

.details {
  font-weight: bold;
  font-size: 14px;
}

</style>

<h1><a href="webmasters_v3.html">Search Console API</a> . <a href="webmasters_v3.searchanalytics.html">searchanalytics</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
  <code><a href="#query">query(siteUrl, body)</a></code></p>
<p class="firstline">Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days.</p>
<h3>Method Details</h3>
<div class="method">
    <code class="details" id="query">query(siteUrl, body)</code>
  <pre>Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days.

When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.

Args:
  siteUrl: string, The site's URL, including protocol. For example: http://www.example.com/ (required)
  body: object, The request body. (required)
    The object takes the form of:

{
    "startDate": "A String", # [Required] Start date of the requested date range, in YYYY-MM-DD format, in PST time (UTC - 8:00). Must be less than or equal to the end date. This value is included in the range.
    "endDate": "A String", # [Required] End date of the requested date range, in YYYY-MM-DD format, in PST (UTC - 8:00). Must be greater than or equal to the start date. This value is included in the range.
    "dimensions": [ # [Optional] Zero or more dimensions to group results by. Dimensions are the group-by values in the Search Analytics page. Dimensions are combined to create a unique row key for each row. Results are grouped in the order that you supply these dimensions.
      "A String",
    ],
    "searchType": "A String", # [Optional; Default is "web"] The search type to filter for.
    "dimensionFilterGroups": [ # [Optional] Zero or more filters to apply to the dimension grouping values; for example, 'query contains "buy"' to see only data where the query string contains the substring "buy" (not case-sensitive). You can filter by a dimension without grouping by it.
      {
        "groupType": "A String",
        "filters": [
          {
            "operator": "A String",
            "expression": "A String",
            "dimension": "A String",
          },
        ],
      },
    ],
    "rowLimit": 42, # [Optional; Default is 1000] The maximum number of rows to return. Must be a number from 1 to 5,000 (inclusive).
    "aggregationType": "A String", # [Optional; Default is "auto"] How data is aggregated. If aggregated by property, all data for the same property is aggregated; if aggregated by page, all data is aggregated by canonical URI. If you filter or group by page, choose AUTO; otherwise you can aggregate either by property or by page, depending on how you want your data calculated; see  the help documentation to learn how data is calculated differently by site versus by page.
        # 
        # Note: If you group or filter by page, you cannot aggregate by property.
        # 
        # If you specify any value other than AUTO, the aggregation type in the result will match the requested type, or if you request an invalid type, you will get an error. The API will never change your aggregation type if the requested type is invalid.
  }


Returns:
  An object of the form:

    { # A list of rows, one per result, grouped by key. Metrics in each row are aggregated for all data grouped by that key either by page or property, as specified by the aggregation type parameter.
    "rows": [ # A list of rows grouped by the key values in the order given in the query.
      {
        "keys": [
          "A String",
        ],
        "impressions": 3.14,
        "clicks": 3.14,
        "ctr": 3.14,
        "position": 3.14,
      },
    ],
    "responseAggregationType": "A String", # How the results were aggregated.
  }</pre>
</div>

</body></html>